// FIT_6204_Gorodilov_GreedyPointsDlg.cpp : implementation file
//

#include "stdafx.h"
#include "FIT_6204_Gorodilov_Greedy.h"
#include "FIT_6204_Gorodilov_GreedyPointsDlg.h"


// CFIT_6204_Gorodilov_GreedyPointsDlg dialog

IMPLEMENT_DYNAMIC(CFIT_6204_Gorodilov_GreedyPointsDlg, CDialog)

CFIT_6204_Gorodilov_GreedyPointsDlg::CFIT_6204_Gorodilov_GreedyPointsDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CFIT_6204_Gorodilov_GreedyPointsDlg::IDD, pParent)
	, count(0)
{

}

CFIT_6204_Gorodilov_GreedyPointsDlg::~CFIT_6204_Gorodilov_GreedyPointsDlg()
{
}

void CFIT_6204_Gorodilov_GreedyPointsDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_EDIT1, points);
}


BEGIN_MESSAGE_MAP(CFIT_6204_Gorodilov_GreedyPointsDlg, CDialog)
	ON_EN_CHANGE(IDC_EDIT1, &CFIT_6204_Gorodilov_GreedyPointsDlg::OnEnChangeEdit1)
END_MESSAGE_MAP()


// CFIT_6204_Gorodilov_GreedyPointsDlg message handlers

BOOL CFIT_6204_Gorodilov_GreedyPointsDlg::OnInitDialog(void)
{
	CDialog::OnInitDialog();
	CString buf;
	buf.Format("%d", count);
	points.SetWindowTextA(buf);
	return 0;
}

void CFIT_6204_Gorodilov_GreedyPointsDlg::OnEnChangeEdit1()
{
	int val = 0;
	CString buf;
	points.GetWindowTextA(buf);
	sscanf_s(buf,"%d",&val);
	if ((val > 100000) || (val < 1))
	{
		buf.Format("%d",count);
		if (val != 0)
			points.SetWindowTextA(buf);
	}
	else
	{
		if (count != val)
		{
			count = val;
		}
	}
}
